package com.mofang.powerdekorhelper.adapter;

import android.content.Context;

import com.mofang.powerdekorhelper.R;
import com.mofang.powerdekorhelper.base.recycleview.BaseRecycleViewAdapter;
import com.mofang.powerdekorhelper.base.recycleview.BaseViewHolder;
import com.mofang.powerdekorhelper.model.Product;

import java.util.List;

/**
 * Created by luofei on 2017/8/24 0024.
 */

public class ProductListAdapter extends BaseRecycleViewAdapter {

    public ProductListAdapter(List<?> data, Context mContext, int layoutId) {
        super(data, mContext, layoutId);
    }

    @Override
    protected <T> void convert(BaseViewHolder holder, T bean, int position) {

        Product.Result.ProductData product = (Product.Result.ProductData) bean;

        holder.setText(R.id.product_list_name, product.getProduct_name());

        holder.setText(R.id.product_list_price, "¥" + product.getMin_price());

        holder.setImage(R.id.product_list_imv, product.getImage_url(), R.mipmap.ic_launcher);

        holder.itemView.setTag(product);

    }
}
